<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
if (!isset($_SESSION['username']) ) {
    header('Location: login.php');
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="product" content="Metro UI CSS Framework">
    <meta name="author" content="Sergey S. Pimenov, Ukraine, Kiev">
    <meta name="description" content="Simple responsive css framework">
    <meta name="keywords" content="Metro, ui, responsive, css, framework, library">

    <link href="../css/metro-bootstrap.css" rel="stylesheet">
    <link href="../css/metro-bootstrap-responsive.css" rel="stylesheet">
    <link href="../css/docs.css" rel="stylesheet">
    <link href="../js/prettify/prettify.css" rel="stylesheet">

    <!-- Load JavaScript Libraries -->
    <script src="../js/jquery/jquery.min.js"></script>
    <script src="../js/jquery/jquery.widget.min.js"></script>
    <script src="../js/jquery/jquery.mousewheel.js"></script>
    <script src="../js/prettify/prettify.js"></script>

    <!-- Local JavaScript -->
    <script src="../js/metro/metro-loader.js"></script>
    <!-- Local JavaScript -->
    <script src="../js/docs.js"></script>
    <script src="../js/github.info.js"></script>
    <script src="ckeditor/ckeditor.js"></script>

    <title>Admin</title>
</head>
<body class="metro">
    <header class="bg-dark" data-load="layout/header.php"></header>
    <div class="page">
        <div class="page-region">
            <div class="page-region-content">
                <?php
                    ini_set('include_path', '.;' . dirname(__FILE__));
                    // main content
                    if( !isset( $_GET['mod'] ) ) $_GET['mod'] = 'home'; // init
                    if( !isset( $_GET['act'] ) ) $_GET['act'] = 'index'; // init

                    switch ( $_GET['mod'] ) {
                        case 'home':
                            include('modules/home/controllers/HomeController.php');

                            $controller = new HomeController();
                            $controller->{$_GET['act']}();
                            break;
                        case 'tuvi':
                            include('modules/tuvi/controllers/TuviController.php');

                            $controller = new TuviController();
                            $controller->{$_GET['act']}();
                            break;
                    }
                ?>
            </div>
        </div>
    </div>

    <script src="../js/hitua.js"></script>
    <footer class="bg-dark" data-load="layout/footer.php"></footer>
</body>
</html>